#pragma once
/*
	海龟交易策略模型
*/

/************************************************************************/
/* 
	唐奇安通道
*/
/************************************************************************/
#include <vector>
using namespace std;

class DonchianChannel
{
public:
	DonchianChannel();
	~DonchianChannel();

private:

};

//55日突破长线系统
class SlowChannel : public DonchianChannel
{
public:
	SlowChannel(char* szInstrument, const vector<FutureDayPrice> &dayPriceArr);
	~SlowChannel();

	int enterBreakThrough(const double lastPrice);
	int exitBreakThrough(const double lastPrice);
};


//20日突破短线系统
class FastChannel : public DonchianChannel
{
public:
	FastChannel(char* szInstrument, const vector<FutureDayPrice> &dayPriceArr);
	~FastChannel();

	int enterBreakThrough(const double lastPrice);
	int exitBreakThrough(const double lastPrice);

protected:
	//上一次入市突破做多成本价
	double bullCostPrice;
	//上一次入市突破做空成本价
	double bearCostPrice;
};



class CTurtle:public IStragegyObj
{
public:
	CTurtle();
	~CTurtle();
public:
	//下单
	virtual void Order(void *pData) {}
	//撤单
	virtual void OrderCancel(void *pData) {}
	//tick
	virtual void OnTick(void *pData){}
	//启动
	virtual void Run(){}
private:
	//根据入市和离市信号进行下单建仓和平仓
	int _20DaysEnterBreakThrough();
	int _20DaysExitBreakThrough();
	int _55DaysEnterBreakThrough();
	int _55DaysExitBreakThrough();

	//入市
	void enterMarket();
	//离市
	void exitMarket();
	//加仓
	void increaseUnit();
	//是否达到止损价格，达到的话全部单位都退出
	void stopLoss();
};

